package com.dhq.junit;

import java.io.IOException;

import org.apache.solr.client.solrj.SolrServerException;
import org.junit.Test;

import com.dhq.bean.Product;
import com.dhq.dao.SolrJDao;


public class JunitTest {
	private SolrJDao solrJDao=new SolrJDao();
	@Test
	public void testAdd() throws SolrServerException, IOException{
		for(int i=1;i<=2;i++){
			Product product=new Product();
			product.setId(i);
			product.setName("苹果（Apple）iPhone 5c 16G版 3G手机（白色）电信版");
			product.setDesc("选择“购机送费版”北京用户享全新4G合约套餐资费全网最低！");
			product.setPrice(9f);
			solrJDao.addIndex(product);
		}
		
	}
	@Test
	public void testdel() throws SolrServerException, IOException{
		
		solrJDao.delIndex("2");
	}
	@Test
	public void testupdate() throws IOException, SolrServerException{
		solrJDao.updateIndex();
	}
	@Test
	public void testfind() throws SolrServerException{
		solrJDao.findIndex();
	}
	
}	
